

local Map = game.GetMap()

local SpawnPositions = {}

SpawnPositions["gm_construct"] = Vector(493, -238,85)
SpawnPositions["gm_flatgrass"] = Vector(608, -41, 321)
--SpawnPositions["gm_testroom_race_control-13"] = Vector(-2174, 68, -4750)
SpawnPositions["gm_testroom_race_control-13"] = Vector(-965.94, -525.52, -4913.79)
SpawnPositions["sr_test-race-03"] = Vector(-965.94, -525.52, -4850)
SpawnPositions["sr_test-race-04"] = Vector(-980, -1023, -1000)
SpawnPositions["sr_cylinder_concept_03f"] = Vector(4334, 0, 2550)

local SpawnAngles = {}

SpawnAngles["gm_construct"] = Angle(90, 180, 180)
SpawnAngles["gm_flatgrass"] = Angle(90, 180, 180)
--SpawnAngles["gm_testroom_race_control-13"] = Angle(90, 180, 180)
SpawnAngles["gm_testroom_race_control-13"] = Angle(90, -90, 180)
SpawnAngles["sr_test-race-03"] = Angle(90, -90, 180)
SpawnAngles["sr_test-race-04"] = Angle(90, -90, 180)
SpawnAngles["sr_cylinder_concept_03f"] = Angle(90, 0, 180)

function SpawnScoreboard()

        SBexists = 0

	for k, v in pairs(ents.FindByClass("LuaScoreboard")) do
		SBexists = 1
	end
                
        --print("SBexists: "..SBexists)
        
        if (SBexists == 0) then
            local ent = ents.Create( "LuaScoreboard" )
            ent:SetPos(SpawnPositions[Map])
            ent:SetAngles(SpawnAngles[Map])
            ent:Spawn()
            print("=======SpaceRace Scoreboard Spawned=========")
        else
            print("====SpaceRace Scoreboard Already Spawned====")
        end
        

end
hook.Add("InitPostEntity", "SpawnScoreboard", SpawnScoreboard)
concommand.Add( "sr_spawn_scoreboard", SpawnScoreboard )

